package com.ewhale.feitengguest.api;

import com.ewhale.feitengguest.dto.AliAuthInfoDto;
import com.ewhale.feitengguest.dto.ArticleDetailDto;
import com.ewhale.feitengguest.dto.AuthInfoDto;
import com.ewhale.feitengguest.dto.BalanceDto;
import com.ewhale.feitengguest.dto.HelpCenterDto;
import com.ewhale.feitengguest.dto.MyTaskDetailDto;
import com.ewhale.feitengguest.dto.MyTaskDto;
import com.ewhale.feitengguest.dto.ShopAuthDto;
import com.ewhale.feitengguest.dto.ShopBillDetailDto;
import com.ewhale.feitengguest.dto.ShopBillDto;
import com.ewhale.feitengguest.dto.ShopWalletDto;
import com.ewhale.feitengguest.dto.SignInDto;
import com.ewhale.feitengguest.dto.ThirdInfoDto;
import com.ewhale.feitengguest.dto.VersionDto;
import com.ewhale.feitengguest.dto.WalletLogDto;
import com.ewhale.feitengguest.utils.pay.PayWeixinDto;
import com.simga.library.dto.EmptyDto;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Url;

public interface UserApi {
    /**
     * 修改用户头像
     *
     * @param headPhoto
     * @return
     */
    @FormUrlEncoded
    @POST
    Observable<EmptyDto> resetHeadPhoto(@Url String url, @Field("headPhoto") String headPhoto);

    /**
     * 修改真实姓名
     *
     * @param name
     * @return
     */
    @FormUrlEncoded
    @POST("app/account/updateName.json")
    Observable<EmptyDto> resetName(@Field("name") String name);

    /**
     * 修改昵称
     *
     * @param name
     * @return
     */
    @FormUrlEncoded
    @POST
    Observable<EmptyDto> resetNickName(@Url String url, @Field("nickName") String name);

    /**
     * 修改昵称
     *
     * @param sex
     * @return
     */
    @FormUrlEncoded
    @POST("app/account/updateSex.json")
    Observable<EmptyDto> resetSex(@Field("sex") Integer sex);

    /**
     * 修改用户出生日期
     *
     * @param
     * @return
     */
    @FormUrlEncoded
    @POST("app/account/updateBirth.json")
    Observable<EmptyDto> resetBirthday(@Field("year") Integer year,
                                       @Field("month") Integer month);

    /**
     * 获取认证信息
     *
     * @return
     */
    @POST("app/account/getAccountAuthMsg.json")
    Observable<AuthInfoDto> getAuthInfo();

    /**
     * 提交认证信息
     *
     * @param params
     * @return
     */
    @FormUrlEncoded
    @POST("app/account/commitAccountAuthMsg.json")
    Observable<EmptyDto> commitAccountAuthMsg(@FieldMap Map<String, Object> params);

    /**
     * 获取帮助中心列表
     *
     * @return
     */
    @POST("app/common/getHelpList.json")
    Observable<List<HelpCenterDto>> getHelpList();

    /**
     * 获取文章详情
     *
     * @param id
     * @return
     */
    @FormUrlEncoded
    @POST("app/common/getArticleView.json")
    Observable<ArticleDetailDto> getArticleDetails(@Field("articleId") long id);

    /**
     * 意见反馈
     *
     * @param content
     * @return
     */
    @FormUrlEncoded
    @POST("app/account/commitFeedBack.json")
    Observable<EmptyDto> commitFeedBack(@Field("content") String content);

    /**
     * 获取钱余额、邀请人数、产生佣金
     *
     * @return
     */
    @POST("app/account/getBalanceAndRecommend.json")
    Observable<BalanceDto> laodBalance();

    /**
     * 获取账单列表
     *
     * @param pageSize
     * @param pageNumber
     * @return
     */
    @FormUrlEncoded
    @POST("app/account/getAccountWalletLogList.json")
    Observable<List<WalletLogDto>> laodWalletLog(@Field("pageSize") Integer pageSize,
                                                 @Field("pageNumber") Integer pageNumber);

    /**
     * 提现
     *
     * @param params
     * @return
     */
    @FormUrlEncoded
    @POST("app/account/withdrawal.json")
    Observable<EmptyDto> withdrawal(@FieldMap Map<String, Object> params);

    /**
     * 获取我的任务列表
     *
     * @param pageSize
     * @param pageNumber
     * @return
     */
    @FormUrlEncoded
    @POST("app/mission/myMissionList.json")
    Observable<List<MyTaskDto>> getTaskList(@Field("type") Integer type,
                                            @Field("pageNumber") Integer pageNumber,
                                            @Field("pageSize") Integer pageSize);

    /**
     * 获取已接任务详情
     *
     * @param missionId
     * @return
     */
    @FormUrlEncoded
    @POST("app/mission/findMissionDetailByMissionIdAndUserId.json")
    Observable<MyTaskDetailDto> loadMyTaskDetails(@Field("missionId") Long missionId);


    /**
     * 提交审核
     *
     * @param params
     * @return
     */
    @FormUrlEncoded
    @POST("app/mission/submitMission.json")
    Observable<EmptyDto> submitMission(@FieldMap Map<String, Object> params);

    /**
     * 绑定第三方
     *
     * @return
     */
    @FormUrlEncoded
    @POST("app/account/bindThree.json")
    Observable<EmptyDto> bindThree(@Field("id") String openId,
                                   @Field("type") Integer type);

    /**
     * 绑定微信真实姓名
     *
     * @return
     */
    @FormUrlEncoded
    @POST("app/account/setWechatTureName.json")
    Observable<EmptyDto> bindWechatName(@Field("wechatTureName") String wechatTureName);

    /**
     * 获取支付宝认证需要的参数
     *
     * @return
     */
    @POST("app/common/getAliLoginMsg.json")
    Observable<AliAuthInfoDto> getAliInfo();

    /**
     * 检查更新
     *
     * @param type
     * @return
     */
    @FormUrlEncoded
    @POST("app/common/getAPPUrl.json")
    Observable<VersionDto> getAPPUrl(@Field("type") Integer type);

    /**
     * 签到详情
     *
     * @return
     */
    @POST("app/account/getSignDetail.json")
    Observable<SignInDto> getSignInDetail();

    /**
     * 签到
     *
     * @return
     */
    @POST("app/account/sign.json")
    Observable<EmptyDto> sign();

    /**
     * 获取提现页面支付宝微信的信息
     *
     * @return
     */
    @POST("app/account/geWithdrawalDetail.json")
    Observable<ThirdInfoDto> getWithdrawalDetail();

    /**
     * 获取认证信息
     * @return
     */
    @POST("app/shop/getAuthentication.json")
    Observable<ShopAuthDto> getAuthentication();
    /**
     * 获取认证信息
     * @return
     */
    @FormUrlEncoded
    @POST("app/shop/setAuthentication.json")
    Observable<EmptyDto> saveAuthentication(@FieldMap Map<String,Object> params);

    /**
     * 获取商家钱包
     * @return
     */
    @POST("app/shop/getShopWalletAndStatus.json")
    Observable<ShopWalletDto> getShopWalletAndStatus();

    /**
     * 账单流水
     * @return
     */
    @FormUrlEncoded
    @POST("app/shop/getShopWater.json")
    Observable<List<ShopBillDto>> getShopWater(@Field("pageNumber") Integer pageNumber,
                                         @Field("pageSize") Integer pageSize,
                                         @Field("type") Integer type);

    /**
     * 账单详情
     * @return
     */
    @FormUrlEncoded
    @POST("app/shop/getShopWaterDetail.json")
    Observable<ShopBillDetailDto> getShopWaterDetail(@Field("id") Integer id);

    /**
     * 获取充值信息
     * @return
     */
    @FormUrlEncoded
    @POST("app/shop/walletRecharge.json")
    Observable<Object> walletRecharge(@Field("payType") Integer payType,
                                      @Field("amount") BigDecimal amount);

    /**
     *提现
     * @param params
     * @return
     */
    @FormUrlEncoded
    @POST("app/shop/commitWithdrawal.json")
    Observable<String> commitWithdrawal(@FieldMap Map<String,Object> params);
}
